package routes

import (
	"book-management-system/controllers"
	"github.com/gin-gonic/gin"
)

func SetupRouter() *gin.Engine {
	router := gin.Default()

	// Book routes
	router.GET("/books", controllers.GetBooks)
	router.POST("/books", controllers.CreateBook)
	router.PUT("/books/:id", controllers.UpdateBook)
	router.DELETE("/books/:id", controllers.DeleteBook)

	// User routes
	router.GET("/users", controllers.GetUsers)
	router.POST("/users", controllers.CreateUser)
	router.PUT("/users/:id", controllers.UpdateUser)
	router.DELETE("/users/:id", controllers.DeleteUser)

	// Borrow/Return routes
	router.POST("/users/:user_id/borrow/:book_id", controllers.BorrowBook)
	router.POST("/users/:user_id/return/:book_id", controllers.ReturnBook)
	router.GET("/users/:user_id/borrowed", controllers.GetUserBorrowedBooks)

	return router
}
